import { stringify } from 'qs';
import request from '@/utils/request';
import Constants from '@/utils/constants';

const serviceName = 'database';

export async function queryPageListApi(params) {
  return request(`${Constants.SERVICE_ROOT}/adapi/${serviceName}/entityPage?${stringify(params)}`);
}

export function fetchTableListByDbIdApi(dbId) {
  return request(`${Constants.SERVICE_ROOT}/adapi/${serviceName}/tableList/${dbId}`);
}

export async function addDbInfoApi(params) {
  return request(`${Constants.SERVICE_ROOT}/adapi/${serviceName}/adddatabase`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function dataBaseDetail(params) {
  return request(`${Constants.SERVICE_ROOT}/adapi/${serviceName}/datadetail`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
